# Create your views here.
from django.views.generic import ListView,DetailView
from django.shortcuts import get_object_or_404 
from features.models import Publisher
from django.db import models
from django.http import HttpResponseRedirect,HttpResponse

def index(request):
    return HttpResponse('welcome to features site')

class PublisherList(ListView):
    model = Publisher
    context_object_name = 'my_favourite_publishers'
    template_name = 'publisher_list.html'

class PublisherDetail(DetailView):
    context_object_name = 'publisher'
    model = Publisher
    template_name ='publisher.html'

    def get_queryset(self):
        publisher_keyid = self.kwargs.get('poll_id')
        return Publisher.objects.get(pk=publisher_keyid)